<html>
<head><meta charset="utf-8"><title>Expanding attribute macros · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html">Expanding attribute macros</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240779052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779052">(May 30 2021 at 23:18)</a>:</h4>
<p>I'm interested in contributing to <a href="https://github.com/rust-analyzer/rust-analyzer/issues/8971">https://github.com/rust-analyzer/rust-analyzer/issues/8971</a> - is there already ongoing work on it?</p>



<a name="240779111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779111">(May 30 2021 at 23:20)</a>:</h4>
<p>I have done some work on the prerequisites</p>



<a name="240779133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779133">(May 30 2021 at 23:21)</a>:</h4>
<p>The next steps here are:</p>
<ul>
<li>change r-a's builtin macros to carry their macro kind, add knowledge of the built-in attribute macros</li>
<li>figure out how to make r-a's attribute API work with attribute macro expansion and diagnostics properly</li>
</ul>



<a name="240779244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779244">(May 30 2021 at 23:24)</a>:</h4>
<p>Re: the attribute API – this can possibly be skipped for an MVP, but is probably already causing issues with how we strip <code>#[derive]</code> attributes today.</p>
<p>Basically the issue is that we try to uniquely identify attributes without accounting for <code>cfg_attr</code>, which can expand to any number of attributes. This then leads to us stripping the entire <code>cfg_attr</code> instead of just one of the expanded attributes. It has also causes hangs, where I assumed that attribute IDs are unique (I've fixed or papered over those now).</p>



<a name="240779268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779268">(May 30 2021 at 23:25)</a>:</h4>
<p>One thing that would also help rust-analyzer would be if we didn't have to duplicate this file but could somehow reuse it: <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/builtin_attr.rs">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/builtin_attr.rs</a></p>



<a name="240779314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779314">(May 30 2021 at 23:26)</a>:</h4>
<p>(the <code>EXTRA_ATTRIBUTES</code> const is new, that would go away if we add proper support for the builtin attribute macros - it's also very incomplete apparently <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> )</p>



<a name="240779377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779377">(May 30 2021 at 23:28)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink  [he/him]</span> Are you able to depend on <code>rustc_feature</code> directly?</p>



<a name="240779389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779389">(May 30 2021 at 23:29)</a>:</h4>
<p>not directly, since we target stable</p>



<a name="240779437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779437">(May 30 2021 at 23:30)</a>:</h4>
<p>rustc_feature also uses rustc's list of known symbols, which we don't have</p>



<a name="240779438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779438">(May 30 2021 at 23:30)</a>:</h4>
<p>does <code>rust-analyzer</code> depend on any rustc internal crates?</p>



<a name="240779565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779565">(May 30 2021 at 23:34)</a>:</h4>
<p>on the lexer, yeah</p>



<a name="240779569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779569">(May 30 2021 at 23:34)</a>:</h4>
<p>outside of that, no, but we do use chalk, and have vendored the proc_macro bridge</p>



<a name="240779586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240779586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240779586">(May 30 2021 at 23:35)</a>:</h4>
<p>(I'd also like to stop vendoring the proc_macro code since it tends to break often, but this requires some more complicated changes I think)</p>



<a name="240812003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240812003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240812003">(May 31 2021 at 09:37)</a>:</h4>
<p>To expand on "depend on rustc", we totally can and want to depend on <code>rustc</code> crates, as long as they are build with stable. So, extracting the attribute data table into a separate, "builds on stable" crate would help us, yeah. To be clear, we don't need the APIs to be stable, we are 100% comfortable following whatever changes happen in rustc, as long as "builds on stable" is observed. </p>
<p>Also, <span class="user-mention" data-user-id="125294">@Aaron Hill</span> excited to see experienced rustc hackers taking a look at rust-analyzer. If you need anything to mover forward, feel free to ping us!</p>



<a name="240812478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240812478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240812478">(May 31 2021 at 09:42)</a>:</h4>
<p><code>rustc_features</code> uses the <code>once_cell</code> feature gate and depends on <code>rustc_data_structures</code> and <code>rustc_span</code>. The <code>rustc_data_structures</code> dependency is easy to remove as it only uses <code>FxHashMap</code>. The <code>rustc_span</code> dependency is used for <code>Edition</code>, <code>Symbol</code>, <code>Span</code> and <code>sym</code>, making it much harder to remove. <code>rustc_span</code> uses several feature gates.</p>



<a name="240815808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240815808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240815808">(May 31 2021 at 10:17)</a>:</h4>
<p>Yeah, there's no analogue to <code>span</code>s in rust-analyzer, so any sharing needs to be done in such a way that the callee supplies the span info.</p>



<a name="240820536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240820536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240820536">(May 31 2021 at 11:16)</a>:</h4>
<p>sooo, it turns out we already have most things in place to let this "work", for some values of "work"</p>
<p><a href="/user_uploads/4715/TNdsdMQJqIE4HGWWoi-LoBvB/screenshot-2021-05-31-131459.png">screenshot-2021-05-31-131459.png</a> <a href="/user_uploads/4715/w6xSdHXzWEun0ur1jdm5ZccN/screenshot-2021-05-31-131510.png">screenshot-2021-05-31-131510.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/TNdsdMQJqIE4HGWWoi-LoBvB/screenshot-2021-05-31-131459.png" title="screenshot-2021-05-31-131459.png"><img src="/user_uploads/4715/TNdsdMQJqIE4HGWWoi-LoBvB/screenshot-2021-05-31-131459.png"></a></div><div class="message_inline_image"><a href="/user_uploads/4715/w6xSdHXzWEun0ur1jdm5ZccN/screenshot-2021-05-31-131510.png" title="screenshot-2021-05-31-131510.png"><img src="/user_uploads/4715/w6xSdHXzWEun0ur1jdm5ZccN/screenshot-2021-05-31-131510.png"></a></div>



<a name="240820583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240820583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240820583">(May 31 2021 at 11:16)</a>:</h4>
<p>everything else breaks tho</p>



<a name="240820953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240820953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240820953">(May 31 2021 at 11:20)</a>:</h4>
<p>ship it? <span aria-label="see no evil" class="emoji emoji-1f648" role="img" title="see no evil">:see_no_evil:</span></p>



<a name="240820961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240820961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240820961">(May 31 2021 at 11:21)</a>:</h4>
<p>(what's 'everything else'?)</p>



<a name="240821266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240821266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240821266">(May 31 2021 at 11:24)</a>:</h4>
<p>all the salsa macros apparently expand to thin air</p>



<a name="240821308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240821308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240821308">(May 31 2021 at 11:24)</a>:</h4>
<p>ah</p>



<a name="240821354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240821354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240821354">(May 31 2021 at 11:25)</a>:</h4>
<p>I think we're just missing the attribute arguments here</p>



<a name="240821368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240821368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240821368">(May 31 2021 at 11:25)</a>:</h4>
<p>but I did expect at least some sort of diagnostic</p>



<a name="240821485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240821485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240821485">(May 31 2021 at 11:26)</a>:</h4>
<p>also I think the <code>TokenMap</code> isn't working, and maybe child_by_source also doesn't</p>



<a name="240821497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240821497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240821497">(May 31 2021 at 11:26)</a>:</h4>
<p>so there's still quite a bit of work to do</p>



<a name="240823014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240823014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240823014">(May 31 2021 at 11:44)</a>:</h4>
<p>pushed the code here for now: <a href="https://github.com/jonas-schievink/rust-analyzer/tree/expand-attr-macros">https://github.com/jonas-schievink/rust-analyzer/tree/expand-attr-macros</a></p>



<a name="240841951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240841951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240841951">(May 31 2021 at 14:47)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> Can you elaborate on the motivation behind the compiles-on-stable requirement? Given the extensive use of nightly features in compiler crates, it seems like that requirement causes (or will cause) a large amount of duplication between rustc and rust-analyzer. I can see the value in having independent implementations of different parts of the compiler, but it sounds like you would potentially depend on many more <code>rustc</code> crates if you were able to.</p>



<a name="240842259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240842259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240842259">(May 31 2021 at 14:50)</a>:</h4>
<p>If <code>rust-analyzer</code> were to be made a subtreee (I don't know if there's been any discussion of this), then in my (perhaps naive) view, it could function similar to clippy</p>



<a name="240842348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240842348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240842348">(May 31 2021 at 14:51)</a>:</h4>
<p>Personally I would be fine with targeting nightly instead, if we use a <code>rust-toolchain</code> file we should get roughly the same contributor experience</p>



<a name="240842354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240842354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240842354">(May 31 2021 at 14:51)</a>:</h4>
<p>It requires nightly, uses many compiler crates,  but AFAIK that doesn't cause problems</p>



<a name="240842371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240842371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240842371">(May 31 2021 at 14:51)</a>:</h4>
<p>of course, clippy is also distributed via rustup</p>



<a name="240842599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240842599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240842599">(May 31 2021 at 14:53)</a>:</h4>
<p>So there are two parts here:</p>
<p>1) just using unstable features <br>
2) relying on unstable features for bootstraping purposes </p>
<p>Both have a disadvantage that they make iterating on <code>rust-analyzer</code> itself significantly harder, especially for new contributors. Fast, reliable build &amp; test process is something we optimize for a lot, to make code base more accessible, and to be able to ship more things faster ourselves. </p>
<p>Long term, when we start actually sharing significant parts of code with rustc, I can see us forgoing 1). I'd fight tooth and nail for 2). It's not that I can't be defeated on that one, but I'll fight :-)</p>
<p>Before we reach the situation where <em>a lot</em> of code is shared, I think it makes sense to at least try to stick with stable. <code>chalk</code> is a good example to learn from here.</p>



<a name="240842735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/240842735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#240842735">(May 31 2021 at 14:55)</a>:</h4>
<p>I guess, ther's also </p>
<p>3) not using <code>rustc_private</code> crates </p>
<p>That I think is hardest requirenment, as that goes directly the idea of proper, re-usable libraries.</p>



<a name="241390567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241390567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241390567">(Jun 03 2021 at 13:31)</a>:</h4>
<p>Do we have any features in the <code>hir</code> crates that can be controlled by the settings?</p>



<a name="241390601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241390601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241390601">(Jun 03 2021 at 13:31)</a>:</h4>
<p>Because gating attribute macros behind one currently seems pretty annoying to do</p>



<a name="241390795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241390795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241390795">(Jun 03 2021 at 13:33)</a>:</h4>
<p>I don't think we do</p>



<a name="241391789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241391789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241391789">(Jun 03 2021 at 13:40)</a>:</h4>
<p>the setting would just be another input query, I guess?</p>



<a name="241391874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241391874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241391874">(Jun 03 2021 at 13:41)</a>:</h4>
<p>hmm, yeah, that's pretty simple actually</p>



<a name="241391913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241391913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241391913">(Jun 03 2021 at 13:41)</a>:</h4>
<p>we just can't forget to set it (does salsa have default values for input queries?)</p>



<a name="241391938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241391938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241391938">(Jun 03 2021 at 13:41)</a>:</h4>
<p>hmm I don't know</p>



<a name="241396261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Expanding%20attribute%20macros/near/241396261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Expanding.20attribute.20macros.html#241396261">(Jun 03 2021 at 14:14)</a>:</h4>
<p>okay, that was relatively straightforward</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>